import java.util.Scanner;

/**
 * @Author Stark
 * @Date 2022/1/29 16:47
 */
public class Day1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
//        System.out.println("请输入一个字母：");
//        while(scanner.hasNext()) {
//            char ch = scanner.next().charAt(0);
//            ch = judge(ch);
//            System.out.println(ch);
//        }

        System.out.println("输入具体的年月日：");
        while(scanner.hasNextInt()){
            int year = scanner.nextInt();
            int month = scanner.nextInt();
            int day = scanner.nextInt();
            countDayOfThisYear(year,month,day);
        }
    }
    //编写程序，对输入的年、月、日，给出该天是该年的第多少天？
    public static void countDayOfThisYear(int year, int month, int day) {
        if(year <= 0 || year > 10000) {
            System.err.println("请重新输入正确的年份！");
            return;
        }
        if(month <= 0 || month > 12){
            System.err.println("请重新输入正确的月份！");
            return;
        }
        if(day <= 0 || day > 31){
            System.err.println("请重新输入正确的天数！");
            return;
        }
        int flag = 0;
        if((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))
            flag = 1;
        final int BIGMONTH = 31;
        final int SMONTH = 30;
        final int FEBRUARY = 28 + flag;
        switch(month){
            case 12:
                day += SMONTH;
            case 11:
                day += BIGMONTH;
            case 10:
                day += SMONTH;
            case 9:
                day += BIGMONTH;
            case 8:
                day += BIGMONTH;
            case 7:
                day += SMONTH;
            case 6:
                day += BIGMONTH;
            case 5:
                day += SMONTH;
            case 4:
                day += BIGMONTH;
            case 3:
                day += FEBRUARY;
            case 2:
                day += BIGMONTH;
        }
        System.out.println("已经是今年的" + day + "天了");
    }

    //编写程序，输入一个字符，判断它是否为小写字母，如果是，将它转换成大写字母，否则，不转换。
    public static char judge(char ch) {
        if(Character.isLowerCase(ch)){
            return Character.toUpperCase(ch);
        }
        return ch;
    }
}
